package json;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import net.sf.json.JSONObject;

public class LoginAction {
	private String data;
	public String getData() {
		return data;
	}
	public void setData(String data) {
		this.data = data;
	}
	public String execute() throws  Exception{
		HttpServletRequest request=ServletActionContext.getRequest();
		String name=request.getParameter("name");
		String password=request.getParameter("password");
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("name", name);
		map.put("password", password);
		JSONObject json=JSONObject.fromObject(map);
		data=json.toString();
		return "ok";
	}
}
